<%@ page language="java" import="java.util.*,com.issc.project.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
 <title>注册页面</title>
    <script  type="text/javascript">

        function checkForm(){
            var uvalue=document.getElementById("username").value;
            if(uvalue==""){
                alert("用户名不能为空！");
                return false;
            }else if(!/^[a-zA-Z][a-zA-Z0-9]*$/.test(uvalue)){
            	alert("账号只能由以及数字和字母组成,且必须以字母开头");
            	return false;
            }

            var pvalue=document.getElementById("password").value;
            if(pvalue==""){
                alert("密码不能为空！");
                return false;
            }

            var rvalue=document.getElementById("repassword").value;
            if(rvalue!=pvalue){
                alert("两次密码输入不一致！");
                return false;
            }

            var eValue = document.getElementById("email").value;
            if(!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(eValue)){
                alert("邮箱格式不正确!");
                return false;
            }
        }
    </script>

</head>
<body>
<form action="/LoginServlet" method="post" onsubmit="return checkForm()">

    <table border="0px" width="450px" height="400px" align="center" cellpadding="0px" cellspacing="0px" bgcolor="#faebd7">

        <tr align="center">
            <td  style="font-size:25px" colspan="2">
                注册
            </td>
        </tr>

        <tr>
            <td>
                用户名：
            </td>
            <td >
                <input type="text" name="username" placeholder="请输入用户名" id="username" style="width: 250px;height:20px">
                <p id="p1" > </p>
            </td>
        </tr>


        <tr>
            <td>
                密码：
            </td>
            <td>
                <input type="password" name="password" placeholder="请输入密码" id="password"style="width: 250px;height:20px">
                <p id="p3" > </p>
            </td>
        </tr>
        <tr>
            <td>
                确认密码：
            </td>
            <td>
                <input type="password" name="repassword" placeholder="请再次输入密码" id="repassword"style="width: 250px;height:20px">
                <p id="p4" > </p>
            </td>
        </tr>
        <tr>
            <td>
                邮箱：
            </td>
            <td>
                <input type="text" name="email" placeholder="请输入邮箱" id="email"style="width: 250px;height:20px">
                <p id="p5" > </p>
            </td>
        </tr>

        <tr align="center">
            <td colspan="2">
                <input type="submit" value="注册" style="background-color: #b3d4fc; width: 80px; height: 35px" ><input type="reset" style="background-color:silver;width: 80px; height: 35px">
            </td>
            <!--<td>-->
                <!--<input type="reset" >-->
            <!--</td>-->
        </tr>
    </table>
    </div>
</form>


</body>
</html>